﻿<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.util.*"%>
<html>
	<body>
		<%
			request.setCharacterEncoding("utf-8");
			String stuId = (String)session.getValue("myuser");
			String leaveTime = request.getParameter("leaveTime");
			String backTime = request.getParameter("backTime");
			String destination = request.getParameter("destination");
			String stuTel = request.getParameter("stuTel");
			String parentName = request.getParameter("parentName");
			String parentTel = request.getParameter("parentTel");

			Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
			String url="jdbc:sqlserver://127.0.0.1:1433;DatabaseName=STU_LEAVE_INFO";
			String sqlUser="web";
			String sqlPwd="prog";
			Connection conn = DriverManager.getConnection(url,sqlUser,sqlPwd);
			PreparedStatement stmt = conn.prepareStatement("INSERT INTO T_LEAVE_INFO VALUES(?,?,?,?,?,?,?)");
			stmt.setString(1,stuId);
			stmt.setString(2,leaveTime);
			stmt.setString(3,backTime);
			stmt.setString(4,destination);
			stmt.setString(5,stuTel);
			stmt.setString(6,parentName);
			stmt.setString(7,parentTel);
			stmt.executeUpdate();
			stmt.close();
			conn.close();
			out.println("信息保存成功");
			
			stmt.close();
			conn.close();
		%>
	</body>
</html>
